<?php
class SeniorModel extends Orm_Base{
    public $table = 'senior';
    public $field = array(
        'id' => array('type' => "int(11) unsigned",'comment' => ''),
        'name' => array('type' => "varchar(45)",'comment' => '姓名'),
        'sex' => array('type' => "tinyint(1)",'comment' => '性别'),
        'photo' => array('type' => "varchar(255)",'comment' => '照片'),
        'age' => array('type' => "tinyint(3)",'comment' => ''),
        'nation' => array('type' => "tinyint(2)",'comment' => '民族'),
        'body_status' => array('type' => "tinyint(1)",'comment' => '身体状态(0.健康、1.疾病、2.残疾、3.死亡)'),
        'critcode' => array('type' => "varchar(18)",'comment' => '身份证号'),
        'card_img' => array('type' => "varchar(255)",'comment' => '身份证复印件'),
        'created' => array('type' => "int(11)",'comment' => ''),
        'updated' => array('type' => "int(11)",'comment' => ''),
        'gid' => array('type' => "int(11)",'comemnt' => '关联监护人ID'),
        'religion' => array('type' => "tinyint(1)",'comment' => '宗教'),
        'permanent_residence' => array('type' => "varchar(100)",'comment' => '户口所在地'),
        'birth_date' => array('type' => "tinyint(8)",'comment' => '出生年月'),
        'married_status' => array('type' => "tinyint(1)",'comment' => '婚姻情况'),
        'department' => array('type' => "varchar(100)",'comment' => '所在部门'),
        'education_levels' => array('type' => "tinyint(2)",'comment' => '文化程度'),
        'medical_status' => array('type' => "tinyint(1)",'comment' => '医保状况'),
        'old_address' => array('type' => "varchar(100)",'comment' => '入住前住址'),
        'old_company' => array('type' => "varchar(100)",'comment' => '原工作单位'),
        'temper_hobby' => array('type' => "varchar(100)",'comment' => '脾气爱好'),
        'allergies' => array('type' => "varchar(100)",'comment' => '病史过敏'),
        'is_diabetes' => array('type' => "tinyint(1)",'comment' => '是否有糖尿病'),
        'diet' => array('type' => "varchar(255)",'comment' => '饮食'),
        'life' => array('type' => "varchar(255)",'comment' => '生活'),
        'sleep' => array('type' => "varchar(255)",'comment' => '睡眠'),
        'medical_orders' => array('type' => "varchar(255)",'comment' => '用药医嘱'),
        'physical_examination' => array('type' => "varchar(255)",'comment' => '自测身体检查'),
        'discharge_diagnosis' => array('type' => "varchar(255)",'comment' => '出院诊断'),
        'goods' => array('type' => "varchar(255)",'comment' => '随身物品'),
        'status' => array('type' => "tinyint(1)",'comment' => ''),
        'leave_status' => array('type' => "tinyint(1)",'comment' => '离院状态(1.已离院、2.未离院)'),
    );
    public $pk = 'id';
    //身体状况
    public $tBodystatus = array(
        '0' => '自理',
        '1' => '半自理',
        '2' => '不能自理',
        '3' => '完全不能自理'
    );
    //获取性别
    private function getSex($num){
        $tSIMO = new SexinfoModel;
        $tData = $tSIMO->field('introduce')->where('num = '.$num)->fRow();
        return $tData['introduce'];
    }
    //获取民族
    private function getNation($num){
        $tNIMO = new NationinfoModel;
        $tData = $tNIMO->field('introduce')->where('num = '.$num)->fRow();
        return $tData['introduce'];
    }
    //获取宗教
    private function getReligion($num){
        $tRIMO = new ReligionModel;
        $tData = $tRIMO->field('introduce')->where('num = '.$num)->fRow();
        return $tData['introduce'];
    }
}
?>
